//
//  YYEExampleCell.m
//  YuYingEDU
//
//  Created by zl on 2018/3/13.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYEExampleCell.h"

@implementation YYEExampleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = GeneralBackColor;
        
        _selectBtn = [UIButton buttonWithframe:CGRectZero text:nil font:[UIFont systemFontOfSize:17] textColor:@"#333333" backgroundColor:nil normal:nil selected:nil];
        [self.contentView addSubview:_selectBtn];
        _selectBtn.layer.masksToBounds = YES;
        _selectBtn.layer.borderWidth = 1;
        
        _selectLab = [UILabel labelWithframe:CGRectZero text:nil font:[UIFont systemFontOfSize:17] textAlignment:0 textColor:@"#333333"];
        [self.contentView addSubview:_selectLab];
        _selectLab.numberOfLines = 0;

        
    }
    return self;
}



- (void)setModel:(ChoiceModel *)model
{
    _model = model;
    
    _selectBtn.frame = CGRectMake(25, 0, 23, 23);
    _selectBtn.layer.cornerRadius = _selectBtn.jc_height/2;
    
    _selectLab.frame = CGRectMake(_selectBtn.jc_right+25, 0, kScreenWidth-(_selectBtn.jc_right+25)-12, 0);
    CGSize size = [NSString textHeight:model.opt font:_selectLab.font width:_selectLab.jc_width];
    _selectLab.jc_height = size.height;
    
    model.cellHeight = size.height+22;
    
    if (model.isChoose) {
        _selectBtn.layer.borderColor = [UIColor colorWithHexString:@"#0D61E5"].CGColor;
        _selectLab.textColor = [UIColor colorWithHexString:@"#0D61E5"];
    }
    else {
        _selectBtn.layer.borderColor = [UIColor colorWithHexString:@"#999999"].CGColor;
        _selectLab.textColor = [UIColor colorWithHexString:@"#333333"];

    }
    
    if (_row == 0) {
        model.letter = @"A";
        [_selectBtn setTitle:@"A" forState:UIControlStateNormal];
    }
    if (_row == 1) {
        model.letter = @"B";
        [_selectBtn setTitle:@"B" forState:UIControlStateNormal];

    }
    if (_row == 2) {
        model.letter = @"C";
        [_selectBtn setTitle:@"C" forState:UIControlStateNormal];

    }
    if (_row == 3) {
        model.letter = @"D";
        [_selectBtn setTitle:@"D" forState:UIControlStateNormal];

    }
    if (_row == 4) {
        model.letter = @"E";
        [_selectBtn setTitle:@"E" forState:UIControlStateNormal];

    }
    if (_row == 5) {
        model.letter = @"F";
        [_selectBtn setTitle:@"F" forState:UIControlStateNormal];

    }
    if (_row == 6) {
        model.letter = @"G";
        [_selectBtn setTitle:@"G" forState:UIControlStateNormal];

    }
    
    _selectLab.text = model.opt;
}











@end
